/******************************************************************************
	This file is a part of the Snapshot Bioinformatics Project

	Copyright (C) 2012-2013 Jarom Schow

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef SEQ_RECORD_H
#define SEQ_RECORD_H

#include "BioDefs.h"

#include <QtCore/QStringList>
#include <QtCore/QMap>
#include <QtCore/QDate>
#include <QtCore/QSharedData>

#include "Sequence.h"

namespace Bio {

class SeqFeature;
class SeqReference;
class SqlServer;

class BIO_EXPORT SeqRecord {
	friend class SqlServer;
public:
	SeqRecord();
	SeqRecord( const SeqRecord &other );
	virtual ~SeqRecord();

	QString	getId() const;
	void	setId( const QString &id );

	QString	getName() const;
	void	setName( const QString &name );

	QString	getDescription() const;
	void	setDescription( const QString &description );

	QString	getComment() const;
	void	setComment( const QString &comment );

	int		getBioentryId() const;
	void	setBioentryId( int id );

	int		getTaxonId() const;
	void	setTaxonId( int id );

	int		getNcbiTaxonId() const;
	void	setNcbiTaxonId( int id );

	QDate	getDate() const;
	void	setDate( const QDate &date );

	QString	getAnnotation( const QString &key ) const;
	void	setAnnotation( const QString &key, const QString &value );

	QMapIterator<QString, QString>	getAnnotationIterator() const;

	int			getNumFeatures() const;
	SeqFeature*	getFeature( int which ) const;
	void		addFeature( SeqFeature *feature );

	QListIterator<SeqFeature*>	getFeatureIterator() const;

	int				getNumReferences() const;
	SeqReference*	getReference( int which ) const;
	void			addReference( SeqReference *reference );

	QListIterator<SeqReference*>	getReferenceIterator() const;

	int		getNumXRefs() const;
	QString	getXRef( int which ) const;
	void	addXRef( const QString &ref );

	QStringListIterator	getXRefIterator() const;

	Sequence*	getSequence() const;
	void		setSequence( Sequence *seq );

	SeqRecord&	operator=( const SeqRecord &other );

private:
	SeqRecord( int bioentryId, SqlServer *server );

	class SeqRecordData;
	QSharedDataPointer<SeqRecordData>	m_data;
};

}; // Bio

#endif // SEQ_RECORD_H